<template>
  <div class="chat-footer">
    <ElInput
      class="input"
      rows="3"
      v-model="content"
      placeholder="请输入问题，Enter发送"
      @keyup.enter="onSend" />
    <ElButton type="primary" @click="onSend">发送</ElButton>
  </div>
</template>

<script setup>
import { ElButton, ElInput } from 'element-plus';
import { ref } from 'vue';
import { sendMsg } from '../store'

const content = ref('')
const onSend = async () => {
  const question = content.value.trim()
  if (question) {
    sendMsg(question)
    content.value = ''
  }
}
</script>

<style lang="scss">
.chat-footer {
  padding: 16px 12px;
  display: flex;
  align-items: flex-end;
  .input {
    flex: 1;
    margin-right: 10px;
  }
}
</style>
